﻿#!/usr/bin/env python2
# -*- coding: UTF-8 -*-

"""
This script is used to empty directories. Mainly for disk cleanup.

1. Usage:
  - list your directories inside of the main function array_directories
  - run a cron job at your own interval.

2. Use inside of a cron job.
  - Cron example for every day at 4am: 0 4 * * * root \
  <path-to-script>/clean-cache.py >> /dev/null 2>&1
"""

__author__ = "Sebastiaan de Haan"
__credits__ = ""
__contact__ = "info (at)sebastiaandehaan (dot) org"
__copyright__ = "Sebastiaan de Haan"
__license__ = "GPLv3"
__date__ = "12-12-2011"
__version__ = "1.1.0"
__website__ = "https://code.google.com/p/kyr0-maintenance-scripts/"

from os import system

def cleanDirectory(array):
    """
    Disk cleanup for directories
    delete the directory content.
    """
    for directory in array:
        system('rm -Rf %s*' % (directory))

def main():
    #List directories for cleaning.
    array_directories = ["/var/temp/directory_1",
						 "/var/temp/directory_2"
                        ]

    cleanDirectory(array_directories)

if __name__ == '__main__':
    main()
	